import { _decorator, Component, Label, Node, ProgressBar, tween } from 'cc';
import Utils from '../../utils/Utils';
import GameData from '../../data/GameData';
const { ccclass, property } = _decorator;

@ccclass('StageItem')
export class StageItem extends Component {

    @property({ type: ProgressBar }) progressBar_left: ProgressBar = null;
    @property({ type: ProgressBar }) progressBar_right: ProgressBar = null;
    @property(Label) score_left: Label = null;
    @property(Label) score_right: Label = null;

    protected start(): void {
        this.score_left.string = "0";
        this.score_right.string = "0";
    }

    playAnim() {
        // 进度条从0 到 1
        this.progressBar_left.progress = 0;
        this.progressBar_right.progress = 0;
        tween(this.progressBar_left)
            .to(5, { progress: 1 })
            .start();
        tween(this.progressBar_right)
            .to(5, { progress: 0.9 })
            .start();

        Utils.startAddLable(this.score_left, 0, GameData.getFightingPower(), 5);
        Utils.startAddLable(this.score_right, 0, 1129, 5);
    }
}


